<?php

/*
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Library General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

use EasyActionPHP\Controller as Controller;
use EasyActionPHP\Core as Core;


function smarty_function_html_errors($params, &$smarty) {
    $response = Controller\HttpResponse::getInstance();
    $error_list = $response->getAttribute('__EASYFORM_ERRORS__');
    if (count($error_list) > 0) {
        $output .= Core\ActionResourceBundle::get('error.header');
        foreach ($error_list as $error_message) {
            $output .= Core\ActionResourceBundle::get('error.itemlist', Core\ActionResourceBundle::get($error_message));
        }
        $output .= Core\ActionResourceBundle::get('error.footer');
        return $output;
    }
}

?>
